<?php

require_once BaseUtil::getModulePath("base")  .  '/forms/BaseForm.php';
require_once BaseUtil::getModulePath("order")  .  '/constants/OrderConstant.php';

class ShippingForm extends BaseForm {

    public function __construct ()
    {
        parent::__construct();
        $this->setAction(HttpUtil::getUrl("promotion", "subshipping"));

        // name
        $name = new Zend_Form_Element_Text('name');
        $name->setLabel($this->translate->_('name'));
        $name->addFilter("StringTrim");
        $name->setRequired(true);

        //status
        $status = new Zend_Form_Element_Select('status');
        $status->setLabel($this->translate->_('promotionStatus'));
        $status->setMultiOptions(array("1"=> $this->translate->_('statusA') ,"0"=> $this->translate->_('statusI')));
        $status->setAttrib("onchange", "javascript:Promotion.changeStatus();");

        //shippingMethod
        $shippingMethod = new Zend_Form_Element_Select('shippingMethod');
        $shippingMethod->setLabel($this->translate->_('applyShippingMethod'));
        $shippingMethod->setMultiOptions(OrderConstant::getShippingExpectList());

        //order total
        $total = new Zend_Form_Element_Text('total');
        $total->setLabel($this->translate->_('orderTotal'));
        $total->addFilter("StringTrim");

        $description = new Zend_Form_Element_Textarea('description');
        $description->setLabel($this->translate->_('promotionDesc'));
        $description->setAttribs(array("rows" => 8, "cols" => 40));
        $description->addFilter("StringTrim");
                
        $this->addElements(array($name,$status,$total,$shippingMethod,$description));


        $this->setElementDecorators(array(
            'ViewHelper',
            array(array('div' => 'HtmlTag'), array('tag' => 'div',"class" => "form_element")),
        ));

    }
}
